<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
	<title>Login</title>
	<link rel="stylesheet" type="text/css" href="<%=basePath%>scripts/ext3.4/resources/css/ext-all.css" />
	<script type="text/javascript" src="<%=basePath%>scripts/ext3.4/adapter/ext/ext-base.js"></script>
	<script type="text/javascript" src="<%=basePath%>scripts/ext3.4/ext-all.js"></script>
	<script type="text/javascript" src="<%=basePath%>scripts/ext3.4/src/locale/ext-lang-zh_CN.js"></script>
	<script type="text/javascript">
	Ext.onReady(function() {

		Ext.QuickTips.init();

		var loginPanel = new Ext.FormPanel({
			standardSubmit: true,
			labelWidth : 60,
			frame : true,
			labelAlign : 'right',
			buttonAlign : 'center',
			width : 260,
			defaultType : 'textfield',

			items : [ {
				fieldLabel : '用户名',
				name : 'admin.admin_name'
			}, {
				fieldLabel : '密   码',
				name : 'admin.admin_password',
				inputType : 'password'
			}],

			buttons : [ {
				text : 'Login',
				width : 100,
				handler : function(){
					var form = this.ownerCt.ownerCt.getForm();
					if(form.isValid()){
						form.doAction('submit', {
							url : 'admin/login.action',
							method : 'post',
							success : function(form, action) {
								if(action.result.msg == 'OK'){
									Ext.Msg.alert('OK', '登陆成功');
									window.location.href = '<%=basePath%>admin/adminIndex.jsp';
								}else{
									Ext.Msg.alert('Error', action.result.msg);
								}
							},
							failure : function() {
								Ext.Msg.alert('Error', '系统异常');
							}
						});
		            }
				}
			}]
		});

		var win = new Ext.Window( {
			title : 'Login',
			resizable : false,
			autoHeight : true,
			autoWidth : true,
			modal : false,
			closeAction : 'hide',
			draggable : false,
			closable : false,
			items : [ loginPanel ]
		});
		
		win.show();
	});
	</script>
</head>
<body>
</body>
</html>